-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here

local opts = {
  noremap = true,
  silent = true,
}

vim.keymap.set("i", "jj", "<esc>", opts)
vim.keymap.set("i", "<tab><tab>", "<esc>", opts)
vim.keymap.set("i", "jo", "<esc>o", opts)
vim.keymap.set("i", "jO", "<esc>O", opts)
vim.keymap.set("i", "jw", "<esc>:w<CR>", opts)

vim.keymap.set("n", "U", ":redo<CR>", opts)
vim.keymap.set("n", "H", "^", opts)
vim.keymap.set("n", "L", "$", opts)
vim.keymap.set("n", "<Leader>d", ":w<cr>", opts)
vim.keymap.set("n", ";", ":", opts)

-- 执行当前python文件
vim.keymap.set("n", "<Leader>rp", ":!python %<CR>", opts)
vim.keymap.set("n", "<Leader>rj", ":!node %<CR>", opts)

-- running single python codes
-- vim.kenmap.set("n", "<leader>pn", '<cmd>TermExec cmd="node %"<cr>', { desc = "Run node codes" })

vim.g.encoding = "UTF-8"
